package com.example.task2.customer;

import org.apache.tomcat.util.net.jsse.JSSEUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Deprecated
@RequestMapping(path = "api/v1/customer")
@RestController
public class CustomerController {
   private final CustomerService cs;
  @Autowired
    public CustomerController(CustomerService cs) {
        this.cs=cs;
    }

    @GetMapping
    List<Customer> GetCustomer(){
       return cs.getCustomers();
    }

    @PostMapping
    void createNewCustomer(@RequestBody Customer customer){
        System.out.println("post...请求");
        System.out.println(customer);
    }
    @PutMapping
    void updateCustomer(@RequestBody Customer customer){
        System.out.println("UPDATE 请求");
        System.out.println(customer);
    }

    @DeleteMapping(path="{customerId}")
    void deleteCustomer(@PathVariable("customerId") Long id){

      System.out.println("DELETE 请求，删除 Customer ,其ID为" +id);
    }
}
